import 'package:base_plugin/base_plugin.dart';
import 'package:finance_app/src/common/app_colors.dart';
import 'package:finance_app/src/common/config.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:finance_app/generated/a.dart';

class InvitationItem extends StatelessWidget {
  final bool isSelect;
  final String title;
  final String subTitle;
  final String icon;
  final VoidCallback onTap;

  const InvitationItem(
      {Key key,
      this.isSelect,
      this.onTap,
      this.title,
      this.subTitle,
      this.icon})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding:
          EdgeInsets.only(right: getDp(35), left: getDp(35), bottom: getDp(26)),
      child: PressedOpacityButton(
        onPressed: onTap,
        disabledColor: Colors.white,
        color: Colors.white,
        borderRadius: BorderRadius.circular(getDp(15)),
        boxShadow: [
          BoxShadow(
            color: Colors.black.withOpacity(0.25),
            blurRadius: getDp(20),
            offset: Offset(0, getDp(4)),
            spreadRadius: -getDp(5),
          )
        ],
        border: isSelect
            ? Border.all(
                color: aceBlueColor,
                width: getDp(1),
              )
            : Border(),
        padding: EdgeInsets.symmetric(
          horizontal: getDp(20),
          vertical: getDp(10),
        ),
        child: Row(
          children: [
            SvgPicture.asset(
              isSelect
                  ? A.assetsImagesStyleSelectCheckBox
                  : A.assetsImagesStyleUnSelectCheckBox,
              width: getDp(24),
              height: getDp(24),
            ),
            SizedBox(
              width: getDp(12),
            ),
            Expanded(
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Text(
                    title,
                    style: TextStyle(
                      color: aceBlackColor,
                      fontSize: getSp(14),
                      fontWeight: FontWeight.bold,
                      height: 22 / 14,
                    ),
                  ),
                  Text(
                    subTitle,
                    style: TextStyle(
                      color: aceDarkGrayColor,
                      fontSize: getSp(12),
                      fontWeight: FontWeight.w400,
                      height: 22 / 12,
                    ),
                  ),
                ],
              ),
            ),
            // SvgPicture.asset(
            //   A.assetsImagesInvitationEllipse,
            //   width: getDp(34),
            //   height: getDp(34),
            // )

            CircleAvatar(
              radius: getDp(17),
              child: Text(title.substring(0, 1)),
              backgroundImage:
                  icon != null ? Config.toImageProvider(icon) : null,
            )
          ],
        ),
      ),
    );
  }
}
